EMT Practice Test

1. Question Content...


Question List

Question1: Consider the following table data and PHP code. What is the outcome?
Table data (table name "users" with primary key "id"):

PHP code (assume the PDO connection is correctly established):

Question2: Consider 3 PHP files that are called asynchronously via XmlHttpRequest:

Which of the following statements is true? (Choose two.)

Question3: One common security risk is exposing error messages directly in the browser. Which PHP configuration directive can be disabled to prevent this?

Question4: Which of the following is NOT possible using reflection?

Question5: What is the output of the following code?

Question6: What exception type will catch the error raised by the expression 2 / 0?

Question7: FILL BLANK
Which PHP function is used to validate where the contents of $_FILES['name']['tmp_name'] have really been uploaded via HTTP, and also save the contents into another folder?

Question8: FILL BLANK
Your supervisor wants you to disallow PHP scripts to open remote HTTP and FTP resources using PHP's file functions. Which php.ini setting should you change accordingly?

Question9: Under what condition may HTTP headers be set from PHP if there is content echoed prior to the header function being used?

Question10: Consider the following table data and PHP code. What is the outcome?
Table data (table name "users" with primary key "id"):

PHP code (assume the PDO connection is correctly established):

Question11: You work for a shared hosting provider, and your supervisor asks you do disable user scripts to dynamically load PHP extensions using the d1()function. How can you do this? (Choose two.)

Question12: What is the output of the following code?

Question13: What Content-Type HTTP header value is required when sending an HTTP POST request using JavaScript to ensure that PHP can access the data?

Question14: What is the output of the following code?

Question15: What function is best suited for extracting data from a formatted string into an array?

Question16: Which of the following statements about SOAP are NOT true?

Question17: Which options do you have in PHP to set the expiry date of a session?

Question18: Which of the following is NOT true about PHP traits? (Choose two.)

Question19: Which class of HTTP status codes is used for server error conditions?

Question20: Which of the following are valid code snippets? (Choose three.)

Question21: What is the benefit of using persistent database connections in PHP? (Choose two.)

Question22: In a shared hosting environment, session data can be read by PHP scripts written by any user. How can you prevent this? (Choose two.)

Question23: An HTML form contains this form element:

When this form is submitted, the following PHP code gets executed:

Which of the following actions must be taken before this code may go into production? (Choose two.)

Question24: FILL BLANK
What is the output of the following code?

Question25: What is the output of the following code?

Question26: What is the output of the following code?

Question27: Which of the following are NOT acceptable ways to create a secure password hash in PHP?

Question28: FILL BLANK
What is the output of the following code?

Question29: What is the output of the following code?

Question30: An unbuffered database query will (choose two):

Question31: Assuming UTF-8 encoding, what is the value of $count?
$data == '$la2';
$count = strlen('$data');

Question32: Given a php.ini setting of
default_charset = utf-8
what will the following code print in the browser?

Question33: Which of the following will set a 10 seconds read timeout for a stream?

Question34: What is the output of the following code?

Question35: Is the following code vulnerable to SQL Injection where ($mysqliis an instance of the MySQLi class)?

Question36: After performing the following operations:

What will be the value of $a?

Question37: FILL BLANK
What is the output of the following code?

Question38: What can prevent PHP from being able to open a file on the hard drive? (Choose two.)

Question39: What is the output of the following code?

Question40: Which of the following functions are used to escape data within the context of HTML?

Question41: Given a DateTime object that is set to the first second of the year 2017, which of the following samples will correctly return a date in the format '2017-01-01 00:00:01'?

Question42: What function can reverse the order of values in an array so that keys are preserved?

Question43: How should class MyObject be defined for the following code to work properly? Assume $array is an array and MyObject is a user-defined class.

Question44: Which of the following expressions will evaluate to a random value from an array below?
$array = ["Sue","Mary","John","Anna"];

Question45: An HTML form has two submit buttons. After submitting the form, how can you determine with PHP which button was clicked?

Question46: FILL BLANK
Which PHP function sets a cookie and URL encodes its value when sending it to the browser?